<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.cmccsi.mapper.qxgroupMemberDtoMapper">
	<resultMap id="BaseResultMap" type="com.cmccsi.entity.qxgroupMemberDto">
		<id column="id" property="id" jdbcType="BIGINT" />
		<result column="group_id" property="groupId" jdbcType="BIGINT" />
		<result column="user_id" property="userId" jdbcType="BIGINT" />
		<result column="introducer_id" property="introducerId"
			jdbcType="BIGINT" />
		<result column="title" property="title" jdbcType="VARCHAR" />
		<result column="sort" property="sort" jdbcType="INTEGER" />
		<result column="join_time" property="joinTime" jdbcType="TIMESTAMP" />
	</resultMap>
	<resultMap id="MemberIdsResultMap" type="java.lang.Long">
		<id column="user_id" property="userId" jdbcType="BIGINT" />
	</resultMap>
	<sql id="Base_Column_List">
		id, group_id, user_id, introducer_id, title, sort, join_time
	</sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
		parameterType="java.lang.Long">
		select
		<include refid="Base_Column_List" />
		from qxgroup_member
		where id = #{id,jdbcType=BIGINT}
	</select>
	<select id="selectMemberIdsByGroupId" resultMap="MemberIdsResultMap"
		parameterType="java.lang.Long">
		select user_id
		from qxgroup_member
		where group_id =
		#{groupId,jdbcType=BIGINT}
	</select>
	<select id="selectByUseridAndGroupId" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from qxgroup_member
		where group_id= #{0} And user_id= #{1}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
		delete from qxgroup_member
		where id = #{id,jdbcType=BIGINT}
	</delete>

	<delete id="deleteByGroupidAndMemberids">
		delete from qxgroup_member
		where group_id = #{activityId} and user_id
		in
		<foreach item="item" index="index" collection="userIds" open="("
			separator="," close=")">
			#{item}
		</foreach>
	</delete>

	<delete id="deleteByMemberids">
		delete from qxgroup_member
		where user_id in
		<foreach item="item" index="index" collection="userIds" open="("
			separator="," close=")">
			#{item}
		</foreach>
	</delete>
	<insert id="insert" parameterType="com.cmccsi.entity.qxgroupMemberDto">
		insert into qxgroup_member (id, group_id, user_id,
		introducer_id, title, sort,
		join_time)
		values (#{id,jdbcType=BIGINT}, #{groupId,jdbcType=BIGINT},
		#{userId,jdbcType=BIGINT},
		#{introducerId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER},
		#{joinTime,jdbcType=TIMESTAMP})
	</insert>
	<insert id="insertSelective" parameterType="com.cmccsi.entity.qxgroupMemberDto">
		insert into qxgroup_member
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">
				id,
			</if>
			<if test="groupId != null">
				group_id,
			</if>
			<if test="userId != null">
				user_id,
			</if>
			<if test="introducerId != null">
				introducer_id,
			</if>
			<if test="title != null">
				title,
			</if>
			<if test="sort != null">
				sort,
			</if>
			<if test="joinTime != null">
				join_time,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null">
				#{id,jdbcType=BIGINT},
			</if>
			<if test="groupId != null">
				#{groupId,jdbcType=BIGINT},
			</if>
			<if test="userId != null">
				#{userId,jdbcType=BIGINT},
			</if>
			<if test="introducerId != null">
				#{introducerId,jdbcType=BIGINT},
			</if>
			<if test="title != null">
				#{title,jdbcType=VARCHAR},
			</if>
			<if test="sort != null">
				#{sort,jdbcType=INTEGER},
			</if>
			<if test="joinTime != null">
				#{joinTime,jdbcType=TIMESTAMP},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="com.cmccsi.entity.qxgroupMemberDto">
		update qxgroup_member
		<set>
			<if test="groupId != null">
				group_id = #{groupId,jdbcType=BIGINT},
			</if>
			<if test="userId != null">
				user_id = #{userId,jdbcType=BIGINT},
			</if>
			<if test="introducerId != null">
				introducer_id = #{introducerId,jdbcType=BIGINT},
			</if>
			<if test="title != null">
				title = #{title,jdbcType=VARCHAR},
			</if>
			<if test="sort != null">
				sort = #{sort,jdbcType=INTEGER},
			</if>
			<if test="joinTime != null">
				join_time = #{joinTime,jdbcType=TIMESTAMP},
			</if>
		</set>
		where id = #{id,jdbcType=BIGINT}
	</update>
	<update id="updateByPrimaryKey" parameterType="com.cmccsi.entity.qxgroupMemberDto">
		update qxgroup_member
		set group_id = #{groupId,jdbcType=BIGINT},
		user_id = #{userId,jdbcType=BIGINT},
		introducer_id = #{introducerId,jdbcType=BIGINT},
		title = #{title,jdbcType=VARCHAR},
		sort = #{sort,jdbcType=INTEGER},
		join_time = #{joinTime,jdbcType=TIMESTAMP}
		where id = #{id,jdbcType=BIGINT}
	</update>
</mapper>